#### II Replication ####
### purpose: replicating figure 3 ####
# installing packages ----

list.of.packages = c('ggplot2')
new.packages <- list.of.packages[!(list.of.packages %in% 
                                     installed.packages()[,"Package"])]

if(length(new.packages)) install.packages(new.packages)

# loading packages ----

suppressPackageStartupMessages(
  {
    library(ggplot2)
  }
)

# loading in data ----
aidtrend <- readRDS("~/data/fig_data_aidtrend.RDS")

f3 <- ggplot(aidtrend, aes(date, award, group = source, col=source)) +
  geom_line(show.legend=FALSE) +
  scale_x_continuous(breaks = seq(1985, 2020, 2)) +
  scale_color_manual(values = c("black", "gray60", "red")) +
  annotate(geom="text", x = 2017, y = 11000, label= "contracts + grants", color="gray40") +
  annotate(geom="text", x = 2018, y = 4300, label= "contracts", color="black") +
  theme_bw() +
  xlab("year") +
  ylab("total contract awards (in million dollars)")

ggsave("~figures/figure3_aidtrend.jpeg", f3, width=7, height=4, dpi = 1200)
